<%-- 
    Document   : visualizarPedido
    Created on : 13/11/2011, 01:13:33
    Author     : KOMATSU
--%>

<%-- 
    Document   : pagarConta
    Created on : 12/11/2011, 21:10:12
    Author     : KOMATSU
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <body><div id="container"><div id="content">
        <%@ page import="br.objetos.*, java.util.*" %>
         <%
            MesaMetodos m = new MesaMetodos();
            m.getM().setIdMesa(request.getParameter("idm").toString());
            if (request.getParameter("idm") != null) {
                m.buscarPedidos();
            }
           
        %>
       
                         Mesa: <input readonly="true" type="text" value="<%=request.getParameter("idm")%>" name="idm" size="3">
                       <table border="1" cellspacing="2">
                        <thead>
                            <tr>
                                <th>QTD.</th>
                                <th>PRODUTO</th>
                                <th>VALOR</th>
                                <th>QTD x VALOR</th>
                            </tr>
                        </thead>
                        <tbody>
                            <%
                                 List listaP = new ArrayList();
                                 listaP = m.getListaPedidos();
                                 Double total=0.0;
                                 for (Iterator it = listaP.iterator(); it.hasNext();) {
                                                Pedido ped = (Pedido) it.next();
                                                Double res = Double.parseDouble(ped.getQtde())
                                                        *ped.getPreco();
                                                total=total+res;
                            %>
                            <tr>
                                <th>
                                    <%=ped.getQtde() %>
                                </th>
                                <th>
                                    <%=ped.getProduto().getTipo()%>
                                </th>
                                <th>
                                    <%=ped.getPreco()%>
                                </th>
                                <th>
                                    <%=res%>
                                </th>

                            </tr>
                            <%
                                            }
                            %>
                            <tr>
                                <th>
                                </th>
                                <th>
                                </th>
                                <th>
                                    TOTAL:
                                </th>
                                <th>
                                    <%=total%>
                                </th>
                            </tr>
                        </tbody>
                    </table>
            
    </div><div id="footer" align="center"><%@include file="footer.jsp" %></div></div></body>
</html>
